package com.unism.uniMeterage.meterage.stream.version1_1.util;

import java.util.Map;
import java.util.regex.Pattern;

/**
 * @author liuc
 * 私有工具类
 */
public class PrivateUtil {
    /**
     * 判断map集合是否为null
     * @param m
     * @return
     */
    public static boolean isEmpty(Map<?, ?> m) {
        return m == null || m.size() == 0;
    }
    /**
     * 正则表达式,工具方法
     * @param pattern
     * @param content
     * @return
     */
    public static boolean isMatch(String pattern,String content){
       return Pattern.matches(pattern, content);
    }
    public static String getDefaultKeyClazz() {
        return "stream.worker.*.class";
    }
    public static String getKeyName(String currClazz){
        if(currClazz !=null && !"".trim().equals(currClazz)){
            return currClazz.replace("class","name");
        }
        return  null;
    }
    public static String getKeyNum(String currClazz) {
        if(currClazz !=null && !"".trim().equals(currClazz)){
            return currClazz.replace("class","number");
        }
        return  null;
    }
    public static Boolean isNotEmpty(String str) {
        if(str !=null && !"".trim().equals(str)){
            return true;
        }
        return  false;
    }
    public static void main(String[] args) {
        System.out.println(isMatch("stream.worker.*.class","stream.worker.liuc.class"));
        System.out.println(getKeyName("stream.worker.liuc.class"));
    }



}
